package org.rkuk.kasutil.test.system.handler 
{
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import org.rkuk.kasutil.designPatternTools.AbstractTool;
	import org.rkuk.kasutil.test.event.HandlerEvent;
	import org.rkuk.kasutil.test.framework.TestMethod;
	
	/**
	 * ...
	 * @author rkuk
	 */
	public class AnsyHandler extends Handler 
	{
		private var exclusiveHandler_:Handler;
		
		public function AnsyHandler(eventTarget:EventDispatcher, eventType:String, eventMethod:TestMethod)
		{
			super(eventTarget, eventType, eventMethod);
		}
		
		public function set exclusiveHandler(value:Handler):void
		{
			exclusiveHandler_ = value;
		}
		
		override protected function onTargetEvent(e:Event):void 
		{
			super.onTargetEvent(e);
			
			if (exclusiveHandler_ != null)
				exclusiveHandler_.notifyHandlerEvent(null, HandlerEvent.HANDLER_CANCEL);
				
			notifyHandlerEvent(e, HandlerEvent.HANDLER_TRIGGER);
		}
	}
}